/*
 * @Author: 
 * @Date: 2025-06-11 14:12:26
 * @LastEditTime: 2025-06-11 14:28:09
 * @Description: 
 */
import 'package:flutter/material.dart';

class ScanBox extends StatelessWidget {
  final bool isScanning;
  final VoidCallback onScanPressed;

  const ScanBox({
    super.key,
    required this.isScanning,
    required this.onScanPressed,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 200,
      decoration: BoxDecoration(
        border: Border.all(
          color: isScanning ? Colors.green : Colors.grey,
          width: 2,
        ),
        borderRadius: BorderRadius.circular(8),
      ),
      child: Stack(
        children: [
          Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Icon(
                  Icons.qr_code_scanner,
                  size: 48,
                  color: isScanning ? Colors.green : Colors.grey,
                ),
                const SizedBox(height: 16),
                Text(
                  isScanning ? 'Scaning' : 'Scan Item Barcode',
                  style: TextStyle(
                    fontSize: 18,
                    color: isScanning ? Colors.green : Colors.grey,
                  ),
                ),
                Text(
                  'Position the barcode within the frame',
                  style: TextStyle(
                    color: isScanning ? Colors.green : Colors.grey,
                  ),
                ),
              ],
            ),
          ),
          Positioned(
            bottom: 10,
            right: 10,
            child: IconButton(
              icon: Icon(
                isScanning ? Icons.stop : Icons.play_arrow,
                color: isScanning ? Colors.red : Colors.green,
              ),
              onPressed: onScanPressed,
            ),
          ),
        ],
      ),
    );
  }
}